<template>
  <div class="content">
    <div class="top_list">
      <div class="item_list" v-for="(item, index) in listData" :key="index" @click="goToPage(item)">
        <div class="item_list_l">
          <ImgT :src="`/imgs/club/${item.icon}.webp`" />
        </div>
        <div class="item_list_c">
          {{ t(item.label) }}
        </div>
        <div class="item_list_r">
          <ImgT src="/imgs/club/jianIcon.webp" />
        </div>
      </div>
    </div>
    <div class="bottom_list">
      <div class="title">我加入的俱乐部</div>
      <div class="join_list">
        <div class="item_list">
          <div class="item_list_l">
            <ImgT :src="`/imgs/club/icon1.webp`" />
            <span class="c_name">创建者</span>
          </div>
          <div class="item_list_l">
            俱乐部11
          </div>
        </div>
        <div class="item_list">
          <div class="item_list_l">
            <ImgT :src="`/imgs/club/icon1.webp`" />
          </div>
          <div class="item_list_l">
            俱乐部11
          </div>
        </div>
      </div>

      <div class="title">
        <span>我加入的牌局</span>
        <span></span>
      </div>
      <div class="play_list">
        <div class="item_list">
          <div class="item_list_l">
            <ImgT :src="`/imgs/club/icon1.webp`" />
          </div>
          <div class="item_list_c">
            <div class="top_txt">经典德州扑克-1860</div>
            <div class="c_bottom">
              <span class="c_bottom_box">
                <span class="icon"></span>
                25$
              </span>
              <span class="c_bottom_box">
                 <span class="icon icon_m"></span>
                0.25/0.6
              </span>
            </div>
          </div>
          <div class="item_list_r">
            <span class="icon"></span>
            <span>62/150</span>
          </div>
        </div>
      </div>

    </div>

    <!-- 加入俱乐部弹窗 -->
    <Modal v-model:visible="isShowWin" :title="t('club_page_jrjlb')" @close="">
      <div class="popup_body">
        <div class="info">{{ t('输入俱乐部ID') }}</div>
        <nut-input v-model="club_id" :placeholder="t('请输入俱乐部ID')" />
        <div class="submit_btn">
          <Btn height="44px" width="200px" class="submit" @click="submitAc">{{ t('club_page_ss') }}</Btn>
        </div>
      </div>
    </Modal>
  </div>
</template>

<script setup lang="ts">
import { useI18n } from "vue-i18n";
import { ref } from "vue";
import { useRouter } from "vue-router";
import Modal from "@/components/Modal.vue";
import Btn from "@/components/Btn.vue";

const router = useRouter();
const { t } = useI18n();
const isShowWin = ref(false);
const club_id = ref('');
const listData = ref([
  { label: 'club_page_cjjlb', value: 'create', icon: 'icon1'},
  { label: 'club_page_jrjlb', value: 'join', icon: 'icon2'},
  { label: 'club_page_jrpj', value: 'joinPlay', icon: 'icon3'},
  { label: '快速开始', value: 'start', icon: 'icon4'},
]);

const goToPage = (item: any) => {
  if (item.value === 'create') {
    router.push(`/club/create`)
  } else if (['join', 'joinPlay'].includes(item.value)) {
    isShowWin.value = true
  }
}
const submitAc = () => {
  console.log('加入--')
}

</script>

<style scoped lang="scss">
.popup_body {
  color: #fff;
  padding: 10px;

  .info {
    margin-bottom: 10px;
  }
  :deep(.nut-input) {
    background: rgba(29, 14, 74, 1);
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25) inset;
    border-radius: 8px;
    border-bottom: 0;
    padding: 10px;
  }
  .submit_btn {
    margin: 20px;
    display: flex;
    justify-content: center;
  }
}
.content {
  font-size: 14px;
  margin: 0 0 10px;
  color: #fff;

  .top_list {
    padding: 14px 10px 8px;
    display: flex;
    flex-wrap: wrap;

    .item_list {
      position: relative;
      display: flex;
      align-items: center;
      border-radius: 10px;
      width: 172px;
      height: 48px;
      line-height: 35px;
      padding: 5px 10px;
      margin-bottom: 10px;
      background: url(/imgs/club/listBg.webp) center no-repeat;
      background-size: 100%;

      &:nth-child(2n) {
        margin-left: 10px;
      }
      .item_list_l {
        display: flex;
        img {
          width: 37px;
          height: 37px;
        }
      }
      .item_list_c {
        width: 160px;
        margin-left: 5px;
      }
      .item_list_r {
        img {
          width: 14px;
          height: 14px;
        }
      }

    }
  }
  .bottom_list {
    padding: 0 10px 14px;
    .title {
      font-weight: 600;
      margin-bottom: 15px;
    }
    .join_list {
      .item_list {
        position: relative;
        display: flex;
        align-items: center;
        border-radius: 10px;
        width: 355px;
        height: 48px;
        padding: 5px 10px;
        margin-bottom: 10px;
        background: url(/imgs/club/joinBg.webp) center no-repeat;
        background-size: 100%;
        .item_list_l {
          position: relative;
          display: flex;
          align-items: center;
          .c_name {
            position: absolute;
            width: 44px;
            height: 14px;
            line-height: 14px;
            text-align: center;
            background: url(/imgs/club/userBg.webp) center no-repeat;
            background-size: 100%;
            font-size: .5rem;
            bottom: 0;
            left: -3px;
          }
          img {
            width: 36px;
            height: 36px;
            margin-right: 10px;
          }
        }
      }
    }

    .play_list {
      .item_list {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-radius: 10px;
        width: 355px;
        height: 72px;
        padding: 12px 10px;
        margin-bottom: 10px;
        background: url(/imgs/club/playBg.webp) center no-repeat;
        background-size: 100%;
        .item_list_l {
          display: flex;
          align-items: center;
          img {
            width: 48px;
            height: 48px;
            margin-right: 10px;
          }
        }
        .item_list_c {
          flex: auto;
          .top_txt {
            font-size: 15px;
            font-weight: 500;
          }
          .c_bottom {
            font-size: 13px;
            color: #87A1CE;
            display: flex;
            .c_bottom_box {
              display: flex;
              align-items: center;
              &:last-child {
                margin-left: 20px;
              }
              .icon {
                margin-right: 2px;
                width: 16px;
                height: 16px;
                background: url(/imgs/club/bankIcon.webp) center no-repeat;
                background-size: 100%;
              }
              .icon_m {
                width: 14px;
                height: 14px;
                background-image: url(/imgs/club/monIcon.webp);
              }
            }
          }
        }
        .item_list_r {
          display: flex;
          align-items: center;
          justify-content: center;
          font-size: 13px;
          width: 76px;
          height: 31px;
          background: url(/imgs/club/palyNum.webp) center no-repeat;
          background-size: 100%;
          .icon {
            width: 14px;
            height: 14px;
            margin-right: 5px;
            background: url(/imgs/club/renIcon.webp) center no-repeat;
            background-size: 100%;
          }
        }
      }
    }
  }
}
</style>
